import { Context } from 'koa'
import { get, Controller } from '../decorator'
import { ctgyDao } from '../modules/ctgy/dao/CtgyDao'
import { success } from '../common/ResResult'

// console.log('aa', aa)
@Controller('ctgymodule')
export class CtgyController {
  @get('/findSecThrdCtgys/:firstctgyId')
  async findSecThrdCtgys(_ctx: Context) {
    const { firstctgyId } = _ctx.params
    const r = await ctgyDao.findSecThrdCtgysByCon(firstctgyId)
    // const r = await ctgyDao.findSecThrdCtgysBySql(firstctgyId)
    // console.log('aaaa', r)
    _ctx.body = success(r)
  }

  @get('/findFirstCtgys')
  async findFirstCtgys(ctx: Context) {
    // const datas = success(await CtgyService.findFirstCtgys())
    const r = await ctgyDao.findFirstCtgys()
    ctx.body = success(r)
  }
}
